<template>
    <a-modal
      :title="title"
      :width="1200"
      :visible="visible"
      :confirmLoading="confirmLoading"
      @ok="handleOk"
      @cancel="handleCancel"
      cancelText="关闭"
    >
      <a-table 
        :columns="queryParam.type == 1?columns: columns2" 
        :data-source="dataSource"  
        :pagination="ipagination"
        @change="handleTableChange"
       >
      </a-table>
    </a-modal>
</template>

<script>
  import { filterObj } from '@/utils/util';
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'

  export default {
    name:'msg',
    mixins:[JeecgListMixin],
    data() {
      return {
        title: '',
        visible: false,
        confirmLoading: false,
        queryParam:{
          pushId:'',
          current: 1,
          size: 10,
          type:'',
        },
        columns:[
          {
            title: '序号',
            dataIndex: '',
            key: 'rowIndex',
            width: 120,
            align: "center",
            customRender: function (t, r, index) {
              return parseInt(index) + 1;
            }
          },
          {
            title: '手机号',
            dataIndex: 'tel',
          },
          {
            title: '推送状态',
            dataIndex: 'statusText',
          },
          {
            title: '推送时间',
            dataIndex: 'createTime',
          },
          {
            title: '短信内容',
            dataIndex: 'content',
          },
        ],
        columns2:[
          {
            title: '序号',
            dataIndex: '',
            key: 'rowIndex',
            width: 120,
            align: "center",
            customRender: function (t, r, index) {
              return parseInt(index) + 1;
            }
          },
          {
            title: 'OPENID',
            dataIndex: 'openId',
          },
          {
            title: '推送状态',
            dataIndex: 'statusText',
          },
          {
            title: '推送时间',
            dataIndex: 'createTime',
          },
        ],
        url: {
          list:'/backend/invitation/pageMsgSendLog',
        },
      }
    },
    created() {},
    methods: {
      getQueryParams() {
        this.queryParam.current = this.ipagination.current
        this.queryParam.size = this.ipagination.pageSize
        var param = Object.assign({}, this.queryParam);
        return filterObj(param);
      },
      add() {
        this.edit({})
      },
      edit(record,type) {
        this.queryParam.pushId = record.id
        this.queryParam.type = type
        this.searchQuery()
        this.visible = true
      },
      // 确定
      handleOk() {
        this.close()
      },
      // 关闭
      handleCancel() {
        this.close()
      },
      close() {
        this.$emit('close')
        this.visible = false
      },
    }
  }
</script>
<style scoped lang="less">

</style>